﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;

namespace EF6Demo.Model
{
    public class Post
    {
        [Key]
        public int PostId { get; set; }
        public string Title { get; set; }

        public DateTime? DateCreated { get; set; }
        public string Content { get; set; }

        //[Index(IsUnique=true)] 创建索引 失败，没有找到
        public int Rating { get; set; }

        public int BlogId { get; set; }

        /// <summary>
        /// 外键
        /// </summary>
        [ForeignKey("BlogId")]
        public Blog Blog { get; set; }

        public ICollection<Comment> Comments { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public Person CreatedBy { get; set; }
 

        /// <summary>
        /// 编辑人
        /// </summary>
        public Person UpdatedBy { get; set; }
    }
}
